<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('student/index')}">所有学生</a></li>
        <li class="active"><a href="{:url('student/add')}">添加学生</a></li>
    </ul>
    <form class="form-horizontal js-ajax-form margin-top-20" action="{:url('student/add')}" method="post">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>头像</label>
            <input id="photo-1" type="hidden" name="image" >
            <input id="photo-1-name" type="text" name="photo_name" title="图片名称">
            <a href="javascript:uploadOneImage('图片上传','#photo-1');">上传</a>
            <img id="photo-1-preview" width="150px">
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>姓名</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="name" name="name">
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>性别</label>
            <div class="col-md-6 col-sm-10">
                <input type="radio" name="sex" value="1">男
                <input type="radio" name="sex" value="2">女
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>年龄</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="age" name="age">
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>手机号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="mobile" name="mobile">
            </div>
        </div>
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label"><span class="form-required">*</span>身份证号</label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" id="idcard" name="idcard">
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">所属学校:</label>
            <div class="col-md-6 col-sm-10">
                <select name="" id="selectSchool" class="form-control">
                    <option value="0">请选择学校</option>
                    <volist name="school" id="vo">
                        <option value="{$vo.id}">{$vo.name}</option>
                    </volist>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label for="input-name" class="col-sm-2 control-label">所属班级:</label>
            <div class="col-md-6 col-sm-10">
                <select name="room_id" class="form-control" id="room">
                    <option value="">请选择班级</option>
                </select>
            </div>
        </div>    
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                <a class="btn btn-default" href="{:url('admin/student/index')}">{:lang('BACK')}</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $(function () {
       
        $('#selectSchool').change('click',function () {
            
            var schoolId=$('#selectSchool').val();
            
            $.ajax({
                url:"{:url('student/getRoom')}",
                type:"POST",
                data:{school_id:schoolId},
                success:function (res) {
                    console.log(res);
                    $('#room').html(res);
                }
            });
        });
    })
</script>
</body>
</html>